<template>
  <div class="box">
    <bgBox>
      <sectionTitle title="公司概况" ></sectionTitle>
      <div class="echartsContent">
        <labelBox v-for="(item,index) in list" :key="index" :label="item.name" :value="item.value"  @titleClick="titleClick"/>
        <pieEcharts title="公司概况" :totalNum="totalNum" :list="list"/>
        <!-- <labelBox :label="'控股'" :value="'10'"  @titleClick="titleClick"/>
        <labelBox :label="'参股'" :value="'10'"  @titleClick="titleClick"/> -->
      </div>
    </bgBox>
  </div>
</template>

<script setup lang="ts">
import bgBox from '../components/bgBox.vue'
import sectionTitle from '../components/sectionTitle.vue'
// import lineEcharts from '../components/lineEcharts.vue'
import pieEcharts from '../components/pieEcharts.vue'
import labelBox from '../components/labelBox.vue'
import { currentGET } from "@/api";
import { PopupType } from '../../index.d'
import { inject } from 'vue'
import { ref, reactive } from "vue";
const showPopup = inject('showPopup') as (data: PopupType) => void;
/**
 * 获取列表点击事件
 */
const titleClick = (item: Object) => {
  console.log(item)
    showPopup({ type: 21, show: true, popupFlag: 'enterpriseList', searchInfo: {businessModel: item.name }})
    // showPopup({ type: 5, show: true, popupFlag: 'info', })
}
const totalNum = ref(0);
const list = ref([]);
const getData = () => {
  currentGET("enterpriseProfile").then((res) => {
    console.log(res);
    if (res.success) {
      totalNum.value = res.data.totalNum;
      list.value = res.data.list;
    }
  });
};
getData();
</script>

<style scoped lang="less">
.box {
  height: 220px;
  .echartsContent {
    display: flex;
    flex-direction: row;
    height: 180px;
  }

}
</style>
